<?php

include_once 'Expression.php';

class StringExpression extends Expression
{
    public function __construct($value = '')
    {
        parent::__construct();
        $this->set_Value($value);
    }
    
    public function __set($name, $value)
    {
        parent::__set($name, $value);
        
        if($name == 'Value')
        {
            $this->set_Value($value);
        }
    }
    
    public function __get($name)
    {
        $ret = parent::__get($name);
        
        if($ret != null)
        {
            return $ret;
        }
        
        if($name == 'Value')
        {
            return $this->get_Value();
        }
    }
    
    public function get_Value()
    {
        return $this->Value;
    }

    public function set_Value($Value)
    {
        if(is_string($Value))
        {    
            $this->Value = $Value;
        }
        else 
        {
            throw new InvalidArgumentException(
                'The value should be a string');
        }
    }

    private $Value = '';
}

?>
